<?php
session_start();
if(isset($_SESSION['admin_id'])) {
    include "../../include/dbFunctions.php";
    $id=$_POST['id'];
    $name=htmlspecialchars($_POST['name'],ENT_QUOTES);
    $status=$_POST['status'];
    $level=htmlspecialchars($_POST['level'],ENT_QUOTES);
    $last_modified = date("Y-m-d H:i:s");
//update event table
    $query1 = "UPDATE event
            SET event_name = '".$name."',
                event_status = '".$status."',
                    event_class_level = '".$level."',
                last_modified = '".$last_modified."'
            WHERE event_id=$id";
    $result1 = executeQuery($query1);
    $link = "../eventView.php?id=$id";
    if (($result1!=0)) {
        $_SESSION['mes']="The record has been updated successfully";
    } else {
        $_SESSION['mes']="Error! Please try again";
    }
    header("Location: $link ");
    ?>
    <?php
}else {
    header("Location: ../include/login.html");
}
?>